<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language=javascript src="dialog.js"></script>
<link href='dialog.css' type='text/css' rel='stylesheet'>
<style>
FIELDSET{
	border: 1px solid #A9BAC9;
	width:98%
}
.normal{
	color:#6D6C6C;
	font: 12px "宋体";
	font-weight:bold;
}
</style>
<TITLE>上传图片...</TITLE>
<script language="javascript">
var uploadSuccess = false;	//标志是否上传
function ok(){
	if (uploadSuccess) {
		if (fileName.value=="") {
			alert("文件正在上传中,请稍等再试......");
			return;
		}
	}
	var aReturnValue = new Array(fileDir.value,fileName.value,fileSize.value);
	window.returnValue = aReturnValue;
	window.close();
}

function uploadFile(){
	if (uploadForm.file.value == "") {
		alert("请选择文件");
		return;
	}
	var arrSize = uploadForm.file.value.toLowerCase().split(".");
	if (arrSize.length==1){
		alert("你所选择的文件类型在彩信中不支持!");
		return;
	}
	var extName = arrSize[arrSize.length-1];
	var allowedExtName=",jpg,jpeg,gif,png,amr,midi,";
	if (allowedExtName.indexOf(','+extName+',') == -1) {
		alert("你所选择的文件类型在彩信中不支持!")
		return ;
	}
	//文件上传
	uploadForm.submit();
	uploadSuccess = true;
	document.getElementById("uploadButton").value = "文件正在上传中...";
	document.getElementById("uploadButton").disabled=true;
}

function callback(file_dir,file_name,file_size,msg){
	fileDir.value = file_dir;
	fileName.value = file_name;
	fileSize.value = file_size;
	ok();
}
</script>
<BODY>
		<form action="upload.jsp" id="uploadForm" name="uploadForm" encType="multipart/form-data"  method="post" target="hiddenFrame" >
<table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize><tr><td>
<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
	<td class="normal" style="color:red;">说明:<br/>　　图片文件目前支持:GIF、JPG/JPEG<br/><br/></td>
</tr>
<tr>
	<td>
	<fieldset>
	<legend class="normal">选择文件</legend>
	<table border=0 cellpadding=5 cellspacing=0 width="100%">
	<tr><td>
		<table border=0 cellpadding=0 cellspacing=2 style="width:350px">
		<tr>
			<td noWrap width="100%" colspan="2"><input type="file" name="file" id='file' style='width:100%' size=30 style="font-size:9.2pt"></td>
		</tr>
		<tr>
			<td noWrap width="100%" style="font-size:9.2pt"><input type="checkbox" name="zip" checked value="zip">自动压缩&nbsp;&nbsp;该选项会将图片缩小为200*150大小的图片</td>
		</tr>
		<tr>
			<td noWrap width="20%"><input type="button" value=' 上 传 ' onclick="uploadFile()" id="uploadButton" style="font-size:9.2pt"></td>
		</tr>
		</table>
	</td></tr>
	</table>
	</fieldset>
	</td>
</tr></table>
</td></tr></table>
<iframe name='hiddenFrame' id="hiddenFrame" style='display:none'></iframe>
</form>
<input type="hidden" id="fileDir" value=""/>
<input type="hidden" id="fileName" value=""/>
<input type="hidden" id="fileSize" value=""/>
</body>
</html>
